<template>
  <div class="tabbarItem" @click="swichView" :class="{ active: isActive }">
    <slot name="iconfont"></slot>
    <slot name="itemname"></slot>
    <slot name="circle"></slot>
  </div>
</template>

<script>
export default {
  name: "tabbarItem",
  props: {
    path: {
      type: String,
      require: true
    }
  },
  data() {
    return {};
  },
  methods: {
    swichView() {
      this.$router.replace(this.path);
    }
  },
  computed: {
    isActive() {
      return this.$route.path === this.path;
    }
  }
};
</script>

<style scoped lang="less">
.tabbarItem {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  padding: 6.4px 0 4px 0;
}
</style>
